package com.bl.weilan.manager.controller.institution;

import com.bl.weilan.common.ApiResponseBody;
import com.bl.weilan.manager.controller.BaseController;
import com.bl.weilan.service.biz.institution.InstitutionService;
import com.bl.weilan.service.vo.DelBody;
import com.bl.weilan.service.vo.DelListBody;
import com.bl.weilan.service.vo.company.CompanyListVo;
import com.bl.weilan.service.vo.information.InformationModVo;
import com.bl.weilan.service.vo.institution.InstitutionAddVo;
import com.bl.weilan.service.vo.institution.InstitutionListVo;
import com.bl.weilan.service.vo.institution.InstitutionModVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import lombok.extern.log4j.Log4j2;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;
import javax.validation.Valid;

@RestController
@Log4j2
@RequestMapping(value = {"/weilan/manager/institution"})
@Api(value = "通知相关", description = "机构相关manager")
public class InstitutionController extends BaseController {
    @Autowired
    InstitutionService institutionService;

//    @ApiOperation(value = "删除一条机构信息", notes = "删除一条机构信息 ")
//    @ApiImplicitParams({
//    })
//    @PostMapping(value = {"/del"})
//    public ApiResponseBody del(
//            @Valid @RequestBody DelBody body, BindingResult result,
//            HttpServletRequest request) {
//        institutionService.del(body);
//        return ApiResponseBody.createSuccessBody(null);
//    }
//
//    @ApiOperation(value = "编辑机构信息", notes = "编辑机构信息 ")
//    @ApiImplicitParams({})
//    @PostMapping(value = {"/modify"})
//    public ApiResponseBody modify(
//            @Valid @RequestBody InstitutionModVo body, BindingResult result,
//            HttpServletRequest request) {
//
//        ApiResponseBody validResult = validParams(result);
//        if (validResult != null) {
//            return validResult;
//        }
//        institutionService.modify(body);
//        return ApiResponseBody.createSuccessBody(null);
//    }
//
//
//    @ApiOperation(value = "新增机构信息", notes = "新增机构信息 ")
//    @ApiImplicitParams({})
//    @PostMapping(value = {"/add"})
//    public ApiResponseBody add(
//            @Valid @RequestBody InstitutionAddVo body, BindingResult result,
//            HttpServletRequest request) {
//
//        ApiResponseBody validResult = validParams(result);
//        if (validResult != null) {
//            return validResult;
//        }
//        institutionService.add(body);
//        return ApiResponseBody.createSuccessBody(null);
//    }
//
//    @ApiOperation(value = "删除批量", notes = "删除批量 ")
//    @ApiImplicitParams({
//    })
//    @PostMapping(value = {"/del_list"})
//    public ApiResponseBody delList(
//            @Valid @RequestBody DelListBody body, BindingResult result,
//            HttpServletRequest request) {
//
//        institutionService.delList(body);
//
//        return ApiResponseBody.createSuccessBody(null);
//    }
//
//    @ApiOperation(value = "获取机构列表信息", notes = "获取机构列表信息")
//    @ApiImplicitParams({
//            @ApiImplicitParam(name = "page", value = "页数", required = false, paramType = "query", dataType = "int", defaultValue = "1"),
//            @ApiImplicitParam(name = "size", value = "每页大小", required = false, paramType = "query", dataType = "int", defaultValue = "10")})
//    @GetMapping(value = {"/get_list"})
//    public ApiResponseBody<InstitutionListVo> institutionAllList(
//            @RequestParam(value = "page", required = false, defaultValue = "1") int page,
//            @RequestParam(value = "size", required = false, defaultValue = "10") int size,
//            HttpServletRequest request) {
//
//        Pageable pageable = new PageRequest(page - 1, size);
//
//        InstitutionListVo institutionListVo = institutionService.getAllInstitutionLists(pageable);
//
//        return ApiResponseBody.createSuccessBody(institutionListVo);
//    }
//
//    @ApiOperation(value = "通过姓名查找机构", notes = "通过姓名查找机构")
//    @ApiImplicitParams({
//            @ApiImplicitParam(name = "name", value = "姓名 ", required = false, paramType = "query", dataType = "String"),
//            @ApiImplicitParam(name = "page", value = "页数", required = false, paramType = "query", dataType = "int", defaultValue = "1"),
//            @ApiImplicitParam(name = "size", value = "每页大小", required = false, paramType = "query", dataType = "int", defaultValue = "10")})
//    @GetMapping(value = {"/search_list"})
//    public ApiResponseBody<InstitutionListVo> institutionListByName(
//            @RequestParam(value = "name", required = false) String name,
//            @RequestParam(value = "page", required = false, defaultValue = "1") int page,
//            @RequestParam(value = "size", required = false, defaultValue = "10") int size,
//            HttpServletRequest request) {
//
//        Pageable pageable = new PageRequest(page - 1, size);
//
//        InstitutionListVo institutionListVo = institutionService.getInstitutionByName(name,pageable);
//
//        return ApiResponseBody.createSuccessBody(institutionListVo);
//    }

}
